Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IOS-XR] Fix show vrf all detail parser - capture all interface names #911

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Kani999
Copy link
Contributor

@Kani999 Kani999 commented Nov 8, 2024

Description

Enhance interface parsing in 'show vrf all detail' parser

Implemented a general regex pattern to capture all interface names:

  • Replaced the previous regex that relied on specific interface prefixes (e.g., Gi, Bun, Ten, etc.) with a more general pattern r'^(?P<intf>[A-Za-z][-A-Za-z0-9/.:]+)$'.
    • This allows the parser to match any interface name, accommodating various naming conventions and ensuring that all interfaces are properly captured.
  • Introduced in_interfaces_section flag for accurate section tracking:
    • Initialized in_interfaces_section = False at the beginning of the parsing process.
    • Set in_interfaces_section = True upon encountering the Interfaces: line.
    • Used this flag to determine when interface lines should be parsed.
    • When a non-interface line is encountered within the Interfaces section, set in_interfaces_section = False
    • This ensures that the parser continues to process the current line with other parsing rules, preventing the omission of critical sections like address families and route targets.

Motivation and Context

Replaced the previous regex that relied on specific interface prefixes (e.g., Gi, Bun, Ten, etc.) with a more general pattern

Checklist:

  • I have updated the changelog.
  • I have updated the documentation (If applicable).
  • I have added tests to cover my changes (If applicable).
  • All new and existing tests passed.
  • All new code passed compilation.

Closes #910

- Implemented a general regex pattern to capture all interface names
    - Replaced the previous regex that relied on specific interface prefixes (e.g., Gi, Bun, Ten, etc.) with a more general pattern `r'^(?P<intf>[A-Za-z][-A-Za-z0-9/.:]+)$'`
- Introduced `in_interfaces_section` flag for accurate section tracking
@Kani999 Kani999 requested a review from a team as a code owner November 8, 2024 09:48
@Kani999
Copy link
Contributor Author

Kani999 commented Nov 8, 2024

Hello,

could you please fix the checks?
I'm failing at https://github.com/CiscoTestAutomation/genieparser/actions/runs/11739813058/job/32705079893?pr=911

Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.8.18/x64/bin/pyats", line 8, in <module>
    sys.exit(main())
  File "src/pyats/cli/__main__.py", line 35, in pyats.cli.__main__.main
  File "src/pyats/cli/core.py", line 38, in pyats.cli.core.CLI.__init__
  File "src/pyats/cli/core.py", line 79, in pyats.cli.core.CLI.load_commands
  File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2449, in load
    self.require(*args, **kwargs)
  File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/pkg_resources/__init__.py", line 2472, in require
    items = working_set.resolve(reqs, env, installer, extras=self.extras)
  File "/opt/hostedtoolcache/Python/3.8.18/x64/lib/python3.8/site-packages/pkg_resources/__init__.py", line 777, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.VersionConflict: (genie.libs.parser 24.10 (/home/runner/work/genieparser/genieparser/src), Requirement.parse('genie.libs.parser<24.10.0,>=24.9.0'))
Error: Process completed with exit code 1.

which is same error as the main branch is dealing with https://github.com/CiscoTestAutomation/genieparser/actions/runs/11520480651/job/32071894701

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[IOS-XR] show vrf all detail parser - Interfaces list not captured
1 participant